<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>[attribute$=value]</title>
        <link type="text/css" rel="stylesheet" href='../../css/c1.css'>
        <style>
            *{
                margin: 0 auto;
                padding: 0;
            }
            p{
                padding: 5px 10px;
            }
        </style>
        <script src="../../work/jquery-1.12.4.min.js"></script>
        <script>
            jQuery(function ($) {
                $("#btn1",".code").click(function () {
                    $("tr[class $= 'd']").css({backgroundColor:'red'});
                });

            });
        </script>
    </head>
    <body>
    <div class="title">[attribute$=value]</div>
    <p>匹配给定的属性是以某些值结尾的元素。</p>
    <p style="font-weight: bold">attribute</p>
    <p style="padding:5px 20px;">属性名。</p>
    <hr/>
    <p style="font-weight: bold">value</p>
    <p style="padding:5px 20px;">属性值。引号在大多数情况下是可选的。但在遇到诸如属性值包含"]"时，用以避免冲突。</p>
    <hr/>
    <div class="title">代码示例</div>
    <div class="code">
                        <pre>
                            &lt;script&gt;
                                jQuery(function ($) {
                                    $("#btn1",).click(function () {
                                        $(<span>"tr[class $= 'd'"</span>).css({backgroundColor:'red'});
                                        //<span>查找所有 class 属性以 d 结尾 tr 元素</span>
                                    });
                                });
                           &lt;/script&gt;

                          &lt;table border="1"&gt;
                                &lt;tr  id="tr1" class = 'tr'&gt;&lt;td&gt;Header 1&lt;/td&gt;&lt;/tr&gt;
                                &lt;tr class = 'tr'&gt;&lt;td&gt;Value 1&lt;/td&gt;&lt;/tr&gt;
                                &lt;tr  id="tr2" <span>class = 'td'</span>&gt;&lt;td&gt;Value 2&lt;/td&gt;&lt;/tr&gt;
                          &lt;/table&gt;
                          &lt;button id="btn1" style="margin: 10px;"&gt;点击查看效果&lt;/button&gt;
                        </pre>
    </div>
    <div class="title">代码示例</div>
    <div class="code">
        <table border="1">
            <tr id="tr1" class = 'tr'><td>Header 1</td></tr>
            <tr class="tr"><td>Value 1</td></tr>
            <tr id="tr2" class="td"><td>Value 2</td></tr>
        </table>
        <button id="btn1" style="margin: 10px;">点击查看效果</button>
    </div>
    </body>
</html>